package com.duoduo.demo.springnoxml.api;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.duoduo.demo.springnoxml.service.HelpService;
import com.duoduo.demo.springnoxml.vo.HelpCategoryVO;
import com.duoduo.demo.springnoxml.vo.HelpKeywordVO;
import com.duoduo.demo.springnoxml.vo.HelpTopicVO;

/**
 * REST接口（API）
 * @author chengesheng@kedacom.com
 * @date 2017年11月15日下午5:40:41
 */
@RestController("/api/help")
public class HelpApi {

	@Autowired
	private HelpService helpService;

	@RequestMapping("/category/parent/{parentId}")
	public List<HelpCategoryVO> listCategoryByParent(@PathVariable Integer parentId) {
		return helpService.listCategoryByParent(parentId);
	}

	@RequestMapping("/keyword/{keywordId}/topics")
	public List<HelpTopicVO> listTopicByKeyword(@PathVariable Integer keywordId) {
		return helpService.listTopicByKeyword(keywordId);
	}

	@RequestMapping("/topic/category/{categoryId}")
	public List<HelpTopicVO> listTopicByCategory(@PathVariable Integer categoryId) {
		return helpService.listTopicByCategory(categoryId);
	}

	@RequestMapping("/topic/{topicId}/keywords")
	public List<HelpKeywordVO> listKeywordByTopic(@PathVariable Integer topicId) {
		return helpService.listKeywordByTopic(topicId);
	}
}
